# Data pre-processing
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings("ignore")
import seaborn as sns
import plotly as pl
import plotly.express as px
import plotly.graph_objects as go
%matplotlib inline
#Reading a text file and storing it into a dataframe.
CovidVariant = pd.read_csv('covid-variants1.csv')
CovidVariant.head(9999999)
| location | date | variant | num_sequences | perc_sequences | num_sequences_total | |
|---|---|---|---|---|---|---|
| 0 | Angola | 2020-12-21 | B.1.160 | 0.0 | 0.0 | 93 |
| 1 | Angola | 2020-12-21 | B.1.620 | 0.0 | 0.0 | 93 |
| 2 | Angola | 2020-12-21 | B.1.258 | 0.0 | 0.0 | 93 |
| 3 | Angola | 2020-12-21 | B.1.221 | NaN | NaN | 93 |
| 4 | Angola | 2020-12-21 | B.1.1.302 | NaN | NaN | 93 |
| ... | ... | ... | ... | ... | ... | ... |
| 34564 | Zimbabwe | 2021-02-08 | B.1.621 | NaN | NaN | 37 |
| 34565 | Zimbabwe | 2021-02-08 | S:677P.Pelican | NaN | NaN | 37 |
| 34566 | Zimbabwe | 2021-02-08 | S:677H.Robin1 | NaN | NaN | 37 |
| 34567 | Zimbabwe | 2021-02-08 | others | 0.0 | 0.0 | 37 |
| 34568 | Zimbabwe | 2021-02-08 | non_who | 0.0 | 0.0 | 37 |
34569 rows × 6 columns
# Filtering out only Delta variant
Delta = CovidVariant.loc[CovidVariant['variant'] == 'Delta']
#Taking the maximim of vaccination counts
Delta1 = Delta.groupby(["location",'variant'])['num_sequences',
'num_sequences_total'].sum().reset_index()
Delta1[Delta1['location'] == 'India']
| location | variant | num_sequences | num_sequences_total | |
|---|---|---|---|---|
| 32 | India | Delta | 15568.0 | 39087 |
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
trace = go.Choropleth(
locations = Delta1['location'],
locationmode='country names',
z = Delta1['num_sequences'],
text = Delta1['num_sequences_total'],
autocolorscale =False,
reversescale = True,
colorscale = 'viridis',
marker = dict(
line = dict(
color = 'rgb(0,0,0)',
width = 0.5)
),
colorbar = dict(
title = 'Total Delta cases',
tickprefix = '')
)
data = [trace]
layout = go.Layout(
title = 'Total Delta cases for country',
geo = dict(
showframe = True,
showlakes = False,
showcoastlines = True,
projection = dict(
type = 'natural earth'
)
)
)
fig = dict( data=data, layout=layout )
iplot(fig)
fig = px.treemap(Delta1,values = 'num_sequences',
path = ['num_sequences_total','location'],
title="Total Delta variants for a country")
fig.show()
India = CovidVariant.loc[CovidVariant['location'] == 'India']
UK = CovidVariant.loc[CovidVariant['location'] == 'United Kingdom']
RSA = CovidVariant.loc[CovidVariant['location'] == 'Russia']
GER = CovidVariant.loc[CovidVariant['location'] == 'Germany']
INDDelta = India.loc[India['variant'] == 'Delta']
UKDelta = UK.loc[UK['variant'] == 'Delta']
RSADelta = RSA.loc[RSA['variant'] == 'Delta']
GERDelta = GER.loc[GER['variant'] == 'Delta']
INDDelta['date'] = pd.to_datetime(INDDelta['date'])
UKDelta['date'] = pd.to_datetime(UKDelta['date'])
RSADelta['date'] = pd.to_datetime(RSADelta['date'])
GERDelta['date'] = pd.to_datetime(GERDelta['date'])
INDDelta.reset_index(inplace = True)
UKDelta.reset_index(inplace = True)
RSADelta.reset_index(inplace = True)
GERDelta.reset_index(inplace = True)
INDDelta = INDDelta[['location','date','variant','num_sequences','perc_sequences','num_sequences_total']]
UKDelta = UKDelta[['location','date','variant','num_sequences','perc_sequences','num_sequences_total']]
RSADelta = RSADelta[['location','date','variant','num_sequences','perc_sequences','num_sequences_total']]
GERDelta = GERDelta[['location','date','variant','num_sequences','perc_sequences','num_sequences_total']]
INDDelta = INDDelta.rename(columns={"num_sequences":"2_weeks_Delta_cases","perc_sequences":"2_weeks_Delta_cases_%","num_sequences_total":"All Variants"})
UKDelta = UKDelta.rename(columns={"num_sequences":"2_weeks_Delta_cases","perc_sequences":"2_weeks_Delta_cases_%","num_sequences_total":"All Variants"})
RSADelta = RSADelta.rename(columns={"num_sequences":"2_weeks_Delta_cases","perc_sequences":"2_weeks_Delta_cases_%","num_sequences_total":"All Variants"})
GERDelta = GERDelta.rename(columns={"num_sequences":"2_weeks_Delta_cases","perc_sequences":"2_weeks_Delta_cases_%","num_sequences_total":"All Variants"})
# Dividing by 14 to get average daily data from this bi weekly data format
INDDelta['Average Daily Delta variants'] = INDDelta['2_weeks_Delta_cases']/14
UKDelta['Average Daily Delta variants'] = UKDelta['2_weeks_Delta_cases']/14
RSADelta['Average Daily Delta variants'] = RSADelta['2_weeks_Delta_cases']/14
GERDelta['Average Daily Delta variants'] = GERDelta['2_weeks_Delta_cases']/14
#India Bi weekly delta cases
fig = go.Figure(data=[go.Scatter(
x=INDDelta['date'], y=INDDelta['2_weeks_Delta_cases'],
text=['A<br>size: 40', 'B<br>size: 60', 'C<br>size: 80', 'D<br>size: 100'],
mode='markers',
marker=dict(
size=INDDelta['2_weeks_Delta_cases'],
sizemode='area',
sizeref=2.*max(INDDelta['2_weeks_Delta_cases'])/(40.**2),
sizemin=4,
)
)])
fig.show()
fig = go.Figure()
fig.add_trace(go.Bar(x=INDDelta['date'],
y=INDDelta['All Variants'],
name='All Variant Cases Found ',
marker_color='rgb(55, 83, 109)'
))
fig.add_trace(go.Bar(x=INDDelta['date'],
y=INDDelta['2_weeks_Delta_cases'],
name='Delta Variant cases reported',
marker_color='rgb(26, 118, 255)'
))
fig.update_layout(
title='India Delta Variant cases',
xaxis_tickfont_size=14,
yaxis=dict(
title='Number of Total Cases vs Delta Variant Cases',
titlefont_size=16,
tickfont_size=14,
),
legend=dict(
x=0,
y=1.0,
bgcolor='rgba(255, 255, 255, 0)',
bordercolor='rgba(255, 255, 255, 0)'
),
barmode='group',
bargap=0.15, # gap between bars of adjacent location coordinates.
bargroupgap=0.1 # gap between bars of the same location coordinate.
)
fig.show()
#Scatter plot for India delta variant
from plotly.offline import iplot
daily_delta = go.Scatter(x=INDDelta['date'], y=INDDelta['Average Daily Delta variants'], yaxis='y2', name='Average daily Delta cases for 2 weeks')
layout_obj = go.Layout(title='Delta variant', xaxis=dict(title='Date'), yaxis=dict(title='Average daily Delta cases', side='right', overlaying='y'))
fig = go.Figure(data=[daily_delta], layout=layout_obj)
iplot(fig),
(None,)
#UK scatter plot of biweekly delta variant data
= go.Figure(data=[go.Scatter(
x=UKDelta['date'], y=UKDelta['2_weeks_Delta_cases'],
text=['A<br>size: 40', 'B<br>size: 60', 'C<br>size: 80', 'D<br>size: 100'],
mode='markers',
marker=dict(
size=UKDelta['2_weeks_Delta_cases'],
sizemode='area',
sizeref=2.*max(UKDelta['2_weeks_Delta_cases'])/(40.**2),
sizemin=4,
)
)])
fig.show()
fig = go.Figure()
fig.add_trace(go.Bar(x=UKDelta['date'],
y=UKDelta['All Variants'],
name='All Variants cases reported',
marker_color='rgb(55, 83, 109)'
))
fig.add_trace(go.Bar(x=UKDelta['date'],
y=UKDelta['2_weeks_Delta_cases'],
name='Delta Variant cases reported',
marker_color='rgb(26, 118, 255)'
))
fig.update_layout(
title='UK Delta Variant cases',
xaxis_tickfont_size=14,
yaxis=dict(
title='Number of Total Cases vs Delta Variant Cases',
titlefont_size=16,
tickfont_size=14,
),
legend=dict(
x=0,
y=1.0,
bgcolor='rgba(255, 255, 255, 0)',
bordercolor='rgba(255, 255, 255, 0)'
),
barmode='group',
bargap=0.15, # gap between bars of adjacent location coordinates.
bargroupgap=0.1 # gap between bars of the same location coordinate.
)
fig.show()
#Scatter plot for Uk delta variant
from plotly.offline import iplot
daily_delta = go.Scatter(x=UKDelta['date'], y=UKDelta['Average Daily Delta variants'], yaxis='y2', name='Average daily Delta cases for 2 weeks')
layout_obj = go.Layout(title='UK Delta variant', xaxis=dict(title='Date'), yaxis=dict(title='Average daily cases'))
fig = go.Figure(data=[daily_delta], layout=layout_obj)
iplot(fig)
#Russia Scatter plot for bi weekly delta variant
fig = go.Figure(data=[go.Scatter(
x=RSADelta['date'], y=RSADelta['2_weeks_Delta_cases'],
text=['A<br>size: 40', 'B<br>size: 60', 'C<br>size: 80', 'D<br>size: 100'],
mode='markers',
marker=dict(
size=RSADelta['2_weeks_Delta_cases'],
sizemode='area',
sizeref=2.*max(RSADelta['2_weeks_Delta_cases'])/(40.**2),
sizemin=4,
)
)])
fig.show()
fig = go.Figure()
fig.add_trace(go.Bar(x=RSADelta['date'],
y=RSADelta['All Variants'],
name='All Variants cases reported',
marker_color='rgb(55, 83, 109)'
))
fig.add_trace(go.Bar(x=RSADelta['date'],
y=RSADelta['2_weeks_Delta_cases'],
name='Delta Variant cases reported',
marker_color='rgb(26, 118, 255)'
))
fig.update_layout(
title='Russia Delta Variant cases',
xaxis_tickfont_size=14,
yaxis=dict(
title='Number of Total Cases vs Delta Variant Cases',
titlefont_size=16,
tickfont_size=14,
),
legend=dict(
x=0,
y=1.0,
bgcolor='rgba(255, 255, 255, 0)',
bordercolor='rgba(255, 255, 255, 0)'
),
barmode='group',
bargap=0.15, # gap between bars of adjacent location coordinates.
bargroupgap=0.1 # gap between bars of the same location coordinate.
)
fig.show()
#Scatter plot Russia delta variant
from plotly.offline import iplot
daily_delta = go.Scatter(x=RSADelta['date'], y=RSADelta['Average Daily Delta variants'], yaxis='y2', name='Average daily Delta cases for 2 weeks')
layout_obj = go.Layout(title='Russia Covid vs Delta variant', xaxis=dict(title='Date'), yaxis=dict(title='Average daily cases'))
fig = go.Figure(data=[daily_delta], layout=layout_obj)
iplot(fig)
from plotly.offline import iplot
daily_deltaIND = go.Scatter(x=INDDelta['date'], y=INDDelta['2_weeks_Delta_cases'], yaxis='y2', name='Total Delta cases for 2 weeks India')
daily_deltaUK = go.Scatter(x=UKDelta['date'], y=UKDelta['2_weeks_Delta_cases'], yaxis='y2', name='Total Delta cases for 2 weeks UK')
daily_delta = go.Scatter(x=RSADelta['date'], y=RSADelta['2_weeks_Delta_cases'], yaxis='y2', name='Total Delta cases for 2 weeks RSA')
layout_obj = go.Layout(title='Delta variant', xaxis=dict(title='Date'), yaxis=dict(title='total cases'))
fig = go.Figure(data=[daily_deltaIND,daily_deltaUK,daily_delta], layout=layout_obj)
iplot(fig)
Delta2 = Delta1.loc[(Delta1['location']=='India') | (Delta1['location']=='United Kingdom')|(Delta1['location']=='Russia') ]
Delta2
| location | variant | num_sequences | num_sequences_total | |
|---|---|---|---|---|
| 32 | India | Delta | 15568.0 | 39087 |
| 64 | Russia | Delta | 1596.0 | 5934 |
| 81 | United Kingdom | Delta | 203735.0 | 607118 |
import plotly.graph_objects as go
from plotly.subplots import make_subplots
labels = ["India","Russia",'United Kingdom']
# Create subplots: use 'domain' type for Pie subplot
fig = make_subplots(rows=1, cols=2, specs=[[{'type':'domain'}, {'type':'domain'}]])
fig.add_trace(go.Pie(labels=labels, values=Delta2['num_sequences'], name="Delta Variant cases"),
1, 1)
fig.add_trace(go.Pie(labels=labels, values=Delta2['num_sequences_total'], name="Delta Variant tests"),
1, 2)
fig.add_trace(go.Pie(labels=labels, values=Delta2['num_sequences_total'], name="Delta Variant tests"),
1, 2)
# Use `hole` to create a donut-like pie chart
fig.update_traces(hole=.4, hoverinfo="label+value+name")
fig.update_layout(
title_text="Delta Variant across 3 Countries",
# Add annotations in the center of the donut pies.
annotations=[dict(text=' 220899 Delta Cases', x=0.12, y=0.5, font_size=20, showarrow=False),
dict(text='652139 All Variant', x=0.87, y=0.5, font_size=20, showarrow=False)])
fig.show()
#Reading a text file and storing it into a dataframe.
Covid = pd.read_csv('countrySubmissionCount.csv')
Covid.head()
| Country | Total #Delta G/478K.V1 (B.1.617.2+AY.1+AY.2+AY.3) | #Delta G/478K.V1 (B.1.617.2+AY.1+AY.2+AY.3) in past 4 weeks | %Delta G/478K.V1 (B.1.617.2+AY.1+AY.2+AY.3) in past 4 weeks | |
|---|---|---|---|---|
| 0 | United Kingdom | 212,655 | 54,452 | 99.8 |
| 1 | USA | 54,615 | 19,444 | 92.4 |
| 2 | Denmark | 19,089 | 14,689 | 98.2 |
| 3 | India | 18,245 | 260 | 98.9 |
| 4 | Germany | 9,283 | 4,506 | 95.2 |
# Renaming Columns
Covid = Covid.rename(columns={"Total #Delta G/478K.V1 (B.1.617.2+AY.1+AY.2+AY.3)":"Total Delta Cases","#Delta G/478K.V1 (B.1.617.2+AY.1+AY.2+AY.3) in past 4 weeks":"Delta Cases in past 4 weeks","%Delta G/478K.V1 (B.1.617.2+AY.1+AY.2+AY.3) in past 4 weeks":"Delta Cases in %"})
Covid
| Country | Total Delta Cases | Delta Cases in past 4 weeks | Delta Cases in % | |
|---|---|---|---|---|
| 0 | United Kingdom | 212,655 | 54,452 | 99.8 |
| 1 | USA | 54,615 | 19,444 | 92.4 |
| 2 | Denmark | 19,089 | 14,689 | 98.2 |
| 3 | India | 18,245 | 260 | 98.9 |
| 4 | Germany | 9,283 | 4,506 | 95.2 |
| ... | ... | ... | ... | ... |
| 113 | Dominican Republic | 1 | 0 | 0.0 |
| 114 | Tunisia | 1 | 0 | 0.0 |
| 115 | Azerbaijan | 1 | 1 | 100.0 |
| 116 | Colombia | 1 | 0 | 0.0 |
| 117 | Guam | 1 | 0 | 0.0 |
118 rows × 4 columns
ccSc12= pd.read_csv('countrySubmissionCount.csv')
ccSc12.head()
| Country | Total #Delta G/478K.V1 (B.1.617.2+AY.1+AY.2+AY.3) | #Delta G/478K.V1 (B.1.617.2+AY.1+AY.2+AY.3) in past 4 weeks | %Delta G/478K.V1 (B.1.617.2+AY.1+AY.2+AY.3) in past 4 weeks | |
|---|---|---|---|---|
| 0 | United Kingdom | 212,655 | 54,452 | 99.8 |
| 1 | USA | 54,615 | 19,444 | 92.4 |
| 2 | Denmark | 19,089 | 14,689 | 98.2 |
| 3 | India | 18,245 | 260 | 98.9 |
| 4 | Germany | 9,283 | 4,506 | 95.2 |
ccSc12.rename(columns={"Total #Delta G/478K.V1 (B.1.617.2+AY.1+AY.2+AY.3)": "Total Cases",
"#Delta G/478K.V1 (B.1.617.2+AY.1+AY.2+AY.3) in past 4 weeks": "Total Cases in 4 weeks",
"%Delta G/478K.V1 (B.1.617.2+AY.1+AY.2+AY.3) in past 4 weeks":"Percentage in 4 Weeks"}, inplace = True)
labels = ['United Kingdom', 'India', 'Russia']
threeCountries = ccSc12[ccSc12["Country"].isin(labels)]
# threeCountries.apply(threeCountries.to_numeric)
# threeCountries.iloc[:,:].str.replace(',', '').astype(float)
threeCountries['Total Cases'] = threeCountries['Total Cases'].str.replace(',','').astype('float')
threeCountries['Total Cases in 4 weeks'] = threeCountries['Total Cases in 4 weeks'].str.replace(',','').astype('float')
#Data Taken from Worldometer.com
# These data are from july 7 2021 to august 7 2021 for UK, India and Russia respectively
cases_in_4weeks = [1053882,1224983, 742250]
threeCountries['4 weeks total cases'] = cases_in_4weeks
threeCountries['4 weeks delta cases'] = (threeCountries['4 weeks total cases']/100) *threeCountries['Percentage in 4 Weeks']
threeCountries
| Country | Total Cases | Total Cases in 4 weeks | Percentage in 4 Weeks | 4 weeks total cases | 4 weeks delta cases | |
|---|---|---|---|---|---|---|
| 0 | United Kingdom | 212655.0 | 54452.0 | 99.8 | 1053882 | 1051774.236 |
| 3 | India | 18245.0 | 260.0 | 98.9 | 1224983 | 1211508.187 |
| 21 | Russia | 1591.0 | 63.0 | 98.4 | 742250 | 730374.000 |
fig = go.Figure(data=[
go.Bar(name='Total Cases in 4 weeks', x=labels, y=threeCountries['4 weeks total cases']),
go.Bar(name='Percentage in 4 Weeks', x=labels, y=threeCountries['4 weeks delta cases'])
])
fig.update_layout(
title='4 week Cases Vs Predicted Delta variant Cases( 7 July 2021 - 7 August 2021)',
xaxis_tickfont_size=14,
yaxis=dict(
title='Number of Total Cases ',
titlefont_size=16,
tickfont_size=14,
)
)
fig.show()
# This pie chart represents the number of tested, delta found and percentage of delta found in each countries
from plotly.subplots import make_subplots
# Create subplots: use 'domain' type for Pie subplot
labels = ['United Kingdom', 'India', 'Russia']
fig = make_subplots(rows=1, cols=3, specs=[[ {'type':'domain'}, {'type':'domain'},{'type':'domain'}]])
fig.add_trace(go.Pie(labels=labels, values=threeCountries['Total Cases'], name="Delta Variant cases"),
1, 1)
fig.add_trace(go.Pie(labels=labels, values=threeCountries['Total Cases in 4 weeks'], name="Cases in 4 weeks"),
1, 2)
fig.add_trace(go.Pie(labels=labels, values=threeCountries['Percentage in 4 Weeks'], name="Percentage in 4 weeks"),
1, 3)
# Use `hole` to create a donut-like pie chart
fig.update_traces(hole=.4, hoverinfo="label+value+name")
fig.update_layout(
title_text="Delta Variant across 3 Countries",
# Add annotations in the center of the donut pies.
annotations=[dict(text=threeCountries['Total Cases'].sum(), x=0.08, y=0.5, font_size=20, showarrow=False),
dict(text=threeCountries['Total Cases in 4 weeks'].sum(), x=0.50, y=0.5, font_size=20, showarrow=False),
dict(text="Total Case", x=0.92, y=0.5, font_size=20, showarrow=False)])
fig.show()
import plotly.express as px
labels = ['United Kingdom', 'India', 'Russia']
India = CovidVariant.loc[CovidVariant['location'] == 'India']
UK = CovidVariant.loc[CovidVariant['location'] == 'United Kingdom']
RSA = CovidVariant.loc[CovidVariant['location'] == 'Russia']
GER = CovidVariant.loc[CovidVariant['location'] == 'Germany']
df = CovidVariant[CovidVariant['location'].isin(labels)]
df=df[df["variant"]=="Delta"]
df1 = pd.DataFrame(df, columns=["location","date","num_sequences"])
df4 = px.data.stocks()
df1
| location | date | num_sequences | |
|---|---|---|---|
| 12938 | India | 2020-05-11 | 0.0 |
| 12961 | India | 2020-05-25 | 0.0 |
| 12984 | India | 2020-06-08 | 0.0 |
| 13007 | India | 2020-06-22 | 0.0 |
| 13030 | India | 2020-07-06 | 0.0 |
| ... | ... | ... | ... |
| 33224 | United Kingdom | 2021-06-14 | 33616.0 |
| 33247 | United Kingdom | 2021-06-28 | 42295.0 |
| 33270 | United Kingdom | 2021-07-12 | 53571.0 |
| 33293 | United Kingdom | 2021-07-26 | 43466.0 |
| 33316 | United Kingdom | 2021-08-07 | 6968.0 |
99 rows × 3 columns
from plotly.offline import iplot
daily_deltaIND = go.Scatter(x=INDDelta['date'], y=np.log10(INDDelta['2_weeks_Delta_cases']), name='India')
daily_deltaUK = go.Scatter(x=UKDelta['date'], y=np.log10(UKDelta['2_weeks_Delta_cases']), name='UK')
daily_delta = go.Scatter(x=RSADelta['date'], y=np.log10(RSADelta['2_weeks_Delta_cases']), name='RSA')
layout_obj = go.Layout(title='Delta variant', xaxis=dict(title='Date'), yaxis=dict(title='total cases'))
fig = go.Figure(data=[daily_deltaIND,daily_deltaUK,daily_delta], layout=layout_obj)
iplot(fig)
from plotly.offline import iplot
daily_deltaI = go.Scatter(x=INDDelta['date'], y=INDDelta['All Variants'], name='Total India')
daily_deltaU = go.Scatter(x=UKDelta['date'], y=UKDelta['All Variants'], name='Total UK')
daily_deltaR = go.Scatter(x=RSADelta['date'], y=RSADelta['All Variants'], name='Total RSA')
daily_deltaIND = go.Scatter(x=INDDelta['date'], y=INDDelta['2_weeks_Delta_cases'], name='Delta India')
daily_deltaUK = go.Scatter(x=UKDelta['date'], y=UKDelta['2_weeks_Delta_cases'], name='Delta UK')
daily_delta = go.Scatter(x=RSADelta['date'], y=RSADelta['2_weeks_Delta_cases'], name='Delta RSA')
layout_obj = go.Layout(title='Delta variant Vs All Variants', xaxis=dict(title='Date'), yaxis=dict(title='total cases'))
fig = go.Figure(data=[daily_deltaI,daily_deltaU,daily_deltaR, daily_deltaIND,daily_deltaUK,daily_delta], layout=layout_obj)
iplot(fig)
daily_deltaI = go.Scatter(x=INDDelta['date'], y=np.log10(INDDelta['All Variants']), name='Total India')
daily_deltaU = go.Scatter(x=UKDelta['date'], y=np.log10(UKDelta['All Variants']), name='Total UK')
daily_deltaR = go.Scatter(x=RSADelta['date'], y=np.log10(RSADelta['All Variants']), name='Total RSA')
daily_deltaIND = go.Scatter(x=INDDelta['date'], y=np.log10(INDDelta['2_weeks_Delta_cases']), name='Delta India')
daily_deltaUK = go.Scatter(x=UKDelta['date'], y=np.log10(UKDelta['2_weeks_Delta_cases']), name='Delta UK')
daily_delta = go.Scatter(x=RSADelta['date'], y=np.log10(RSADelta['2_weeks_Delta_cases']), name='Delta RSA')
layout_obj = go.Layout(title='Delta variant Vs All Variants', xaxis=dict(title='Date'), yaxis=dict(title='total cases'))
fig = go.Figure(data=[daily_deltaI,daily_deltaU,daily_deltaR, daily_deltaIND,daily_deltaUK,daily_delta], layout=layout_obj)
iplot(fig)
country= pd.read_csv('countries-aggregated.csv')
germany=country[country['Country']=='Germany']
india=country[country['Country']=='India']
from plotly.subplots import make_subplots
fig = make_subplots(specs=[[{"secondary_y": True}]])
fig.add_trace(
go.Scatter(x=germany['Date'], y= germany['Confirmed'], name='Germany Confirmed ') ,
secondary_y=False,
)
fig.add_trace(
go.Scatter(x=india['Date'], y= india['Confirmed'], name=' India Confirmed ') ,
secondary_y=False,
)
fig.add_trace(
go.Scatter(x=germany['Date'], y= germany['Deaths'], name=' Germany Deaths '),
secondary_y=True,
)
fig.add_trace(
go.Scatter(x=india['Date'], y= india['Deaths'], name='India Deaths '),
secondary_y=True,
)
fig.update_yaxes(title_text="Number of Positive Cases", secondary_y=False)
fig.update_yaxes(title_text="Number of Total Deaths", secondary_y=True)
fig.add_annotation(x=60, secondary_y=5000,
text="Starts",
showarrow=True,
arrowcolor="#636363",
arrowsize=2,
arrowwidth=1,
arrowhead=2)
fig.add_annotation(x=110, y=0.3,
text=" Eased ",
showarrow=True,
arrowcolor="#636363",
arrowsize=2,
arrowwidth=1,
arrowhead=2)
iplot(fig)